const defaultProps = {
  children: 'children',
  label: 'label',
}
const data = [
  {
    id: 1,
    label: 'Level one 1',
    children: [
      {
        id: 4,
        label: 'Level two 1-1',
        children: [
          {
            id: 9,
            label: 'Level three 1-1-1',
          },
          {
            id: 10,
            label: 'Level three 1-1-2',
          },
        ],
      },
    ],
  },
  {
    id: 2,
    label: 'Level one 2',
    children: [
      {
        id: 5,
        label: 'Level two 2-1',
      },
      {
        id: 6,
        label: 'Level two 2-2',
      },
    ],
  },
  {
    id: 3,
    label: 'Level one 3',
    children: [
      {
        id: 7,
        label: 'Level two 3-1',
      },
      {
        id: 8,
        label: 'Level two 3-2',
      },
    ],
  },
]
const publicStr = 'views/system/role/config/dialog.'
export default (t: (arg0: string) => any) => [
  {
    prop: 'roleName',
    label: '角色名称',
    rules: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
    fct: {
      placeholder: '请输入角色名称',
      type: 'input',
      model: 'roleName',
    }
  },
  {
    prop: 'roleKey',
    label: '授权字符',
    rules: [{ required: true, message: '请输入授权字符', trigger: 'blur' }],
    fct: {
      placeholder: '请输入授权字符',
      type: 'input',
      model: 'roleKey',
    }
  },
  {
    prop: 'roleSort',
    label: '角色排序',
    rules: [{ required: true, message: '请输入角色排序', trigger: 'blur' }],
    fct: {
      type: 'inputNumber',
      model: 'roleSort',
      placeholder: '请输入角色排序',
      min: 0,
      max: 10,
      onChange(value: any) {
        console.log('value', value)
      }
    }
  },
  {
    prop: 'status',
    label: '状态',
    rules: [{ required: true, message: '请选择状态', trigger: 'change' }],
    fct: {
      type: 'radio',
      model: 'status',
      options: [{ label: '正常', value: 0 }, { label: '下架', value: 1 }],
      onChange(value: any) {
        console.log('value', value)
      }
    }
  },
  {
    label: '菜单授权',
    fct: {
      type: 'tree',
      model: 'menuIds',
      data: data,
      showCheckbox: true,
      nodeKey: "id",
      defaultExpandedKeys: [],
      defaultCheckedKeys: [],
      props: defaultProps,
      checkStrictly: false,
      highlightCurrent: true,
      accordion: true
    }
  },
  {
    label: '备注',
    fct: {
      model: 'remark',
      type: "textarea",
      placeholder: '请输入备注',
      rows: 4,
      maxlength: 200,
      showWordLimit: true,
    }
  },
  {
    type: 'langs',
    path: 'views/system/role/config/dialog'
  }
]